package com.zr.sms.serviceimpl;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import com.zr.sms.dao.EmployeeDao;
import com.zr.sms.dao.FuncDao;
import com.zr.sms.dao.GinventoryInfoDtoDao;
import com.zr.sms.dao.GoodsDao;
import com.zr.sms.dao.GoodsListDao;
import com.zr.sms.dao.RoleDao;
import com.zr.sms.dao.ShopListDao;
import com.zr.sms.daoimpl.EmployeeDaoImpl;
import com.zr.sms.daoimpl.FuncDaoImpl;
import com.zr.sms.daoimpl.GinventoryInfoDtoDaoImpl;
import com.zr.sms.daoimpl.GoodsDaoimpl;
import com.zr.sms.daoimpl.GoodsListDaoImpl;
import com.zr.sms.daoimpl.RoleDaoImpl;
import com.zr.sms.daoimpl.ShopListDaoImpl;
import com.zr.sms.model.Goods;
import com.zr.sms.model.Goodslist;
import com.zr.sms.model.Shoplist;
import com.zr.sms.service.SelectService;

public class SelectServiceImpl implements SelectService{
     EmployeeDao emp=new EmployeeDaoImpl();
     RoleDao role=new RoleDaoImpl();
     FuncDao func=new FuncDaoImpl();
     GoodsDao goods=new GoodsDaoimpl();
     ShopListDao shop=new ShopListDaoImpl();
     GinventoryInfoDtoDao gin=new GinventoryInfoDtoDaoImpl();
     GoodsListDao glist=new GoodsListDaoImpl();
     
	
	public int selectRidByEid(int eid) {
		// TODO Auto-generated method stub
		return emp.selectRidByEid(eid);
	}

	public String selectRfuncsByRid(int rid) {
		
		return role.selectRfuncsByRid(rid);
	}
	
	public JSONArray getFuncs(int parentId, String rfuncs) {
	
		return func.getCurrentUserFuncsByParentId(parentId, rfuncs);
	}
	
	public Goods getGoodsByGid(int gid) {
		
		return goods.selectGoodsByGid(gid);
	}

	
	public Shoplist selectShopListBySid(int sid) {
		
		return shop.selectShopListBySid(sid);
	}

	@Override
	public int getCountByGinventory() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public JSONObject getGinventoryInfos(int start, int pageSize, int ginventory) {
		JSONObject ginventoryinfos = new JSONObject();
		ginventoryinfos.put("total", gin.getCountByGinventory());
		ginventoryinfos.put("rows", JSONArray.fromObject(gin.selectGinventoryInfosByGinventory(start, pageSize, ginventory)));
		return ginventoryinfos;
	}

	@Override
	public Goodslist selectGoodsListBySid(int gid) {
		// TODO Auto-generated method stub
		return glist.selectGoodsListBySid(gid);
	}
	

}
